package com.yulang.common.pojo.response;

import com.yulang.common.pojo.enum_.Constant;
import lombok.Data;

@Data
public class CommonResponse<T> {
    private Integer state;
    private String message;
    private T data;


    public CommonResponse(Integer state, String message) {
        this.state = state;
        this.message = message;
    }

    public CommonResponse(Integer state, String message, T data) {
        this.state = state;
        this.message = message;
        this.data = data;
    }

    public static CommonResponse success(){
        return new CommonResponse(Constant.成功.getStatus(),Constant.成功.getMessage());
    }

    public static CommonResponse error(){
        return new CommonResponse(Constant.失败.getStatus(),Constant.失败.getMessage());
    }




}
